#include "mfile.h"

int get_fileinfo(char *filename,FINFO *fi)
{
    struct stat fbuf;
    int ret;
    char tmp[260];
    char *pos;

    /*get file infomation*/
    assert(filename != NULL);
    memset( &fbuf, 0x00, sizeof(struct stat) );
    if(stat(filename, &fbuf ) != 0 )
    {
        return -1;
    }
    fi->f_size = fbuf.st_size;
    pos = strrchr( filename ,'/' );
    if( pos == NULL )
    {
        strcpy(fi->f_name, filename);
    }
    else
    {
        strcpy( fi->f_name, pos+1 );
    }
    return 0;

}
